package com.imay.live.activity.family.helper.session.extension;

import com.alibaba.fastjson.JSONObject;

/**
 * Created by nick on 2017/9/14.
 * 自定义消息_动态
 */

public class ShortLiveAttachment extends CustomAttachment {

    private final String KEY_CHALLENGEID = "challengeId";
    private final String KEY_CONTENT = "content";
    private final String KEY_SHORTLIVEID = "shortLiveId";
    private final String KEY_TITLE = "title";
    private final String KEY_VIDEOURL = "videoUrl";

    private long challengeId;
    private String content;
    private long shortLiveId;
    private String title;
    private String videoUrl;

    ShortLiveAttachment() {
        super(CustomAttachmentType.dynamics);
    }

    @Override
    protected void parseData(JSONObject data) {
        challengeId = data.getLong(KEY_CHALLENGEID);
        content = data.getString(KEY_CONTENT);
        shortLiveId = data.getLong(KEY_SHORTLIVEID);
        title = data.getString(KEY_TITLE);
        videoUrl = data.getString(KEY_VIDEOURL);
    }

    @Override
    protected JSONObject packData() {
        JSONObject data = new JSONObject();
        data.put(KEY_CHALLENGEID, challengeId);
        data.put(KEY_CONTENT, content);
        data.put(KEY_SHORTLIVEID, shortLiveId);
        data.put(KEY_TITLE, title);
        data.put(KEY_VIDEOURL, videoUrl);
        return data;
    }

    public long getChallengeId() {
        return challengeId;
    }

    public String getContent() {
        return content;
    }

    public long getShortLiveId() {
        return shortLiveId;
    }

    public String getTitle() {
        return title;
    }

    public String getVideoUrl() {
        return videoUrl;
    }
}
